package ex2.SearchingAndSorting.cn.edu.besti.cs1723.GK2301;

public class SortingTest {
    public static void main(String[] args) {
        Sorting sorting = new Sorting();

        Comparable[] a = new Comparable[]{2301,5,11,48,23,10,35,3,110};
        Comparable[] c = new Comparable[]{2301,'a',11,'b','c',10,35,3,110};
        System.out.println("数组：");
        for (Comparable b : a)
        {
            System.out.print(b + " ");
        }

        System.out.println();

        sorting.selectionSort(a);
        System.out.println("选择排序后数组：");
        for (Comparable b : a)
        {
            System.out.print(b + " ");
        }

        System.out.println();
        Comparable[] a1 = new Comparable[]{2301,5,11,48,23,10,35,3,110};
        sorting.shellSort(a1);
        System.out.println("希尔排序后数组：");
        for (Comparable b : a1)
        {
            System.out.print(b + " ");
        }

        System.out.println();
        Comparable[] a2 = new Comparable[]{2301,5,11,48,23,10,35,3,110};
        sorting.heapSort(a2);
        System.out.println("堆排序后数组：");
        for (Comparable b : a2)
        {
            System.out.print(b + " ");
        }

        System.out.println();
        Comparable[] a3 = new Comparable[]{2301,5,11,48,23,10,35,3,110};
        sorting.binarySearchTreeSort(a3);
        System.out.println("二叉查找树排序后数组：");
        for (Comparable b : a3)
        {
            System.out.print(b + " ");
        }

        System.out.println();
        Comparable[] a4 = new Comparable[]{2301,5,11,48,23,10,35,3,110};
        sorting.bubbleSort(a4);
        System.out.println("冒泡排序后数组：");
        for (Comparable b : a4)
        {
            System.out.print(b + " ");
        }

        System.out.println();
        Comparable[] a5 = new Comparable[]{2301,5,11,48,23,10,35,3,110};
        sorting.insertionSort(a5);
        System.out.println("插入排序后数组：");
        for (Comparable b : a5)
        {
            System.out.print(b + " ");
        }

        System.out.println();
        Comparable[] a6 = new Comparable[]{2301,5,11,48,23,10,35,3,110};
        sorting.quickSort(a6);
        System.out.println("快速排序后数组：");
        for (Comparable b : a6)
        {
            System.out.print(b + " ");
        }

        System.out.println();
        Comparable[] a7 = new Comparable[]{2301,5,11,48,23,10,35,3,110};
        sorting.mergeSort(a7);
        System.out.println("归并排序后数组：");
        for (Comparable b : a7)
        {
            System.out.print(b + " ");
        }

        System.out.println();
        sorting.shellSort(c);
        System.out.println("异常排序后数组：");
        for (Comparable b : c)
        {
            System.out.print(b + " ");
        }

    }
}
